<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>信息查询</title>
<style>
    body {
        font-family: Arial, sans-serif;
        margin: 0;
        padding: 0;
        background-color: #f7f7f7;
    }
    .container {
        width: 600px;
        margin: 50px auto;
        padding: 20px;
        background-color: #fff;
        border-radius: 8px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    }
    h1 {
        font-size: 24px;
        font-weight: bold;
        text-align: center;
        margin-bottom: 20px;
    }
    label {
        font-size: 16px;
    }
    input[type="text"], button {
        font-size: 16px;
        padding: 8px;
        margin-top: 8px;
        width: 100%;
        box-sizing: border-box;
    }
    button {
        cursor: pointer;
        background-color: #3498db;
        color: #fff;
        border: none;
        border-radius: 4px;
    }
    button:hover {
        background-color: #2980b9;
    }
    .result {
        font-size: 16px;
        margin-top: 10px;
    }
    .author {
        font-size: 14px;
        text-align: center;
        margin-top: 20px;
    }
</style>
</head>
<body>
<div class="container">
    <h1>信息查询</h1>
    <label for="lol_name">请输入LOL昵称：</label>
    <input type="text" id="lol_name" placeholder="LOL昵称">
    <button onclick="queryLOLInfo()">查询LOL信息</button>
    <div class="result" id="lol_result"></div>
    <br>
    <label for="qq_number">请输入QQ号：</label>
    <input type="text" id="qq_number" placeholder="QQ号">
    <button onclick="queryPhoneNumber()">查询电话号码</button>
    <div class="result" id="phone_result"></div>
    <div class="author">Powered by EKKOJQ</div>
</div>

<script>
    function queryLOLInfo() {
        var lolName = document.getElementById("lol_name").value;

        // 查询LOL信息
        var url_lol = "https://zy.xywlapi.cc/lolname";
        var params_lol = { "name": lolName };

        fetch(url_lol + '?' + new URLSearchParams(params_lol))
            .then(response => response.json())
            .then(data => {
                if (data.status === 200) {
                    var qq = data.qq;
                    var gameName = data.name;
                    var daqu = data.daqu;
                    document.getElementById("lol_result").innerHTML = `QQ号: ${qq}<br>游戏名: ${gameName}<br>游戏大区: ${daqu}`;
                } else {
                    document.getElementById("lol_result").innerHTML = `LOL查询失败: ${data.message}`;
                }
            })
            .catch(error => {
                document.getElementById("lol_result").innerHTML = `LOL查询出错: ${error}`;
            });
    }

    function queryPhoneNumber() {
        var qqNumber = document.getElementById("qq_number").value;

        // 查询电话号码
        var url_phone = "https://zy.xywlapi.cc/qqapi";
        var params_phone = { "qq": qqNumber };

        fetch(url_phone + '?' + new URLSearchParams(params_phone))
            .then(response => response.json())
            .then(data => {
                if (data.status === 200) {
                    var phone = data.phone;
                    var phoneDiqu = data.phonediqu;
                    document.getElementById("phone_result").innerHTML = `绑定号码: ${phone}<br>号码地区: ${phoneDiqu}`;
                } else {
                    document.getElementById("phone_result").innerHTML = `电话号码查询失败: ${data.message}`;
                }
            })
            .catch(error => {
                document.getElementById("phone_result").innerHTML = `电话号码查询出错: ${error}`;
            });
    }
</script>
</body>
</html>
